#!/bin/sh
SCRIPTDIR="$( cd "$( dirname "$0"  )" && pwd  )"
dlldir=$SCRIPTDIR
cd `dirname $0`
#容器名称每个人修改为自己的
contrainsname="qrcoderelease"
contrainshave=`docker ps -a --filter name=$contrainsname --filter status=running`
if [[ $contrainshave == *$contrainsname* ]]
then
    echo "$contrainsname 容器正在运行"
	docker stop $contrainsname
fi
contrainshave=`docker ps -a --filter name=$contrainsname`
if [[ $contrainshave == *$contrainsname* ]]
then
	echo "$contrainsname 容器已经存在，先进行删除"
	docker rm $contrainsname
fi
echo "$contrainsname 容器不存在，开始创建"
#修改-p对应的参数为自己的端口号
docker run --ulimit core=0 --ulimit nofile=65536:65536 --ulimit nproc=65536:65536 --privileged=true -v $dlldir:$dlldir --name $contrainsname -p 18006:18003 -d -v /etc/localtime:/etc/localtime:ro mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic bash $dlldir/run.sh

sleep 1
contrainshave=`docker ps -a --filter name=$contrainsname --filter status=running`
if [[ $contrainshave == *$contrainsname* ]]
then
	echo "$contrainsname 容器启动成功，开始运行"
else
	echo "$contrainsname 容器启动失败"
	exit 1		
fi		




